<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>新增订单数据</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form" lay-filter="addForm">

    <div class="layui-form-item">
        <label class="layui-form-label">昵称</label>
        <div class="layui-input-block">
            <input type="text" name="nickname" id="nickname" class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">日期</label>
        <div class="layui-input-block">
            <input type="text" name="completeDate" id="completeDate" lay-verify="required" lay-reqtext="必填项，岂能为空？"
                   placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">线索条数</label>
        <div class="layui-input-block">
            <input type="text" name="cluesCount" id="cluesCount" lay-verify="required" lay-reqtext="必填项，岂能为空？"
                   placeholder="请输入" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">加粉数</label>
        <div class="layui-input-block">
            <input type="text" name="addFanCount" id="addFanCount" lay-verify="required" lay-reqtext="必填项，岂能为空？"
                   placeholder="请输入" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">加粉未通过数</label>
        <div class="layui-input-block">
            <input type="text" name="addFanFailCount" id="addFanFailCount" lay-verify="required" lay-reqtext="必填项，岂能为空？"
                   placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">电话沟通数</label>
        <div class="layui-input-block">
            <input type="text" name="phoneCount" id="phoneCount" lay-verify="required" lay-reqtext="必填项，岂能为空？"
                   placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">电话非微信数</label>
        <div class="layui-input-block">
            <input type="text" name="phoneNotWxCount" id="phoneNotWxCount" lay-verify="required" lay-reqtext="必填项，岂能为空？"
                   placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">有效接通数</label>
        <div class="layui-input-block">
            <input type="text" name="phoneSuccessCount" id="phoneSuccessCount" lay-verify="required"
                   lay-reqtext="必填项，岂能为空？"
                   placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">成单数量</label>
        <div class="layui-input-block">
            <input type="text" name="orderSuccessCount" id="orderSuccessCount" lay-verify="required" lay-reqtext="必填项，岂能为空？"
                   placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">其他备注</label>
        <div class="layui-input-block">
            <input type="text" name="remark" id="remark" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认</button>
        </div>
    </div>
</div>

<script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            laydate = layui.laydate,
            $ = layui.$;

        form.val("addForm", {
            "nickname": layui.data("user").nickname
        });

        laydate.render({
            elem: '#completeDate',
            trigger: 'click',
            type: 'datetime',
            format: "yyyy-MM-dd HH:mm:ss",
            value: new Date()
        });

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            $.ajax({
                type: "POST",
                url: "/zxjy/statisticsall/add/employee",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify(data.field),
                headers: {
                    'Authorization': layui.data("Authorization")['Authorization'],
                },
                success: function (result) {
                    if (result.state === 200) {
                        parent.layui.table.reload("currentTableId");
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    } else {
                        layer.alert(result.message);
                    }
                }
            });

        });

    });
</script>
</body>
</html>
